Skip to content

Added remove skin button and ability to delete skin from skin directory#306

Open
henbotb wants to merge 1 commit intoMoulberry:masterfrom
henbotb:master
Open

Added remove skin button and ability to delete skin from skin directory#306
henbotb wants to merge 1 commit intoMoulberry:masterfrom
henbotb:master

Conversation

@henbotb
Copy link

@henbotb henbotb commented Mar 18, 2026

Adds a trash can icon on the bottom left of every skin option in the skin menu to delete the skin.

With this implementation, however, the click event on the skin png is also registered, meaning that it registers it as the selected skin whilst removing it, which technically doesn't matter but would be nice to fix for QOL purposes (and also minor performance given the skin widget wouldn't need to reload). I read a few ways to suspend the click event / stop click propagation, but didn't find much documentation on them.

This would also help resolve another minor visual bug where if you delete a skin when it's in a selected state, it removes the selection as a whole.

}

fn get_path_from_skin(backend: &BackendState, skin: Arc<[u8]>) -> Option<PathBuf> {
let Ok(read_dir) = std::fs::read_dir(&backend.directories.skin_library_dir) else {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scanning the whole directory like this seems not ideal, perhaps the skin manager should maintain a map from skin -> path

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally agree, and had the same thought while programming this. I ended up opting for this solution as the it's a fairly low-access function and I didn't see an obvious way to implement something like a map without having to add an extra parameter to a bunch of closures. That said, I will look into something less costly.

If you have any ideas for the structure, let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants